/**
 * A brief explanation for "project.json":
 * Here is the content of project.json file, this is the global configuration for your game, you can modify it to customize some behavior.
 * The detail of each field is under it.
 {
    "project_type": "javascript",
    // "project_type" indicate the program language of your project, you can ignore this field

    "debugMode"     : 1,
    // "debugMode" possible values :
    //      0 - No message will be printed.
    //      1 - cc.error, cc.assert, cc.warn, cc.log will print in console.
    //      2 - cc.error, cc.assert, cc.warn will print in console.
    //      3 - cc.error, cc.assert will print in console.
    //      4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.
    //      5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web.
    //      6 - cc.error, cc.assert will print on canvas, available only on web.

    "showFPS"       : true,
    // Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.

    "frameRate"     : 60,
    // "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.

    "id"            : "gameCanvas",
    // "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.

    "renderMode"    : 0,
    // "renderMode" sets the renderer type, only useful on web :
    //      0 - Automatically chosen by engine
    //      1 - Forced to use canvas renderer
    //      2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers

    "engineDir"     : "frameworks/cocos2d-html5/",
    // In debug mode, if you use the whole engine to develop your game, you should specify its relative path with "engineDir",
    // but if you are using a single engine file, you can ignore it.

    "modules"       : ["cocos2d"],
    // "modules" defines which modules you will need in your game, it's useful only on web,
    // using this can greatly reduce your game's resource size, and the cocos console tool can package your game with only the modules you set.
    // For details about modules definitions, you can refer to "../../frameworks/cocos2d-html5/modulesConfig.json".

    "jsList"        : [
    ]
    // "jsList" sets the list of js files in your game.
 }
 *
 */

var versionUnits = 1;
var versionJudge = 0;
var versionUI = 1;

var userSet = {
	user:null, //用户，联网才存在
	gameUser:null, //玩家，联网时则为玩家自设，非联网则虚拟一玩家
	time:0,
};

var gameRoom = null;
var campaignRoom = null;

var onGameLoaded = [];

/* All size based on 640, 360*/
/* Scale of the zipped image resource */
var SC = 2;

cc.game.onStart = function(){
	//var myDate = new Date();
	//cc.log(myDate.getUTCHours());
	
    cc.view.adjustViewPort(true);
    /* SC must be 1280/640 || 720/360 */
    cc.view.setDesignResolutionSize(1280, 720, cc.ResolutionPolicy.SHOW_ALL);
    cc.view.resizeWithBrowserSize(true);
    
//    PostHttpRequest("http://127.0.0.1:8080/campaignlab/getuser","userid=1",
//    		function(text){
//    			if (text == null){ cc.log("Network error or Access timeout!"); }
//    			else {cc.log(text);}
//    		}
//    );
    
    //以下代码用于提醒自己，不要再幻想动态加载json文件了！！！你已经所有可能都试过了！！！
//    cc.loader.loadTxt("res/BattleOfFrance.txt", function(err,txt){
//    	cc.log(err + ",\n" + txt);
//    	var txt2 =  cc.loader.getRes("res/BattleOfFrance.txt");
//    	cc.log(txt2);
//    	var txt3 = jsb.fileUtils.getStringFromFile("res/BattleOfFrance.txt");
//    	cc.log(txt3);
//    });
    
    for (var idx in onGameLoaded)
    	onGameLoaded[idx]();
    
    //cc.eventManager.addListener({
    //	event: cc.EventListener.KEYBOARD,
    //	onKeyReleased: function(keyCode, event){
    //		if(keyCode == cc.KEY.back){
    //			cc.director.popScene();
    //		}
    //	}
    //}, this);
};
cc.game.run();